﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using JT.WEB.Areas.Identity.Data;
using JT.WEB.Controllers;
using JTWEB3.Controllers;
using JTWEB3.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;

namespace JT.WEB.Models.Were
{
    public partial class TbChuRuInfo
    {
        [Key]
        public int ChuRuId { get; set; }

        [Display(Name = "物品")]
        public int ItemNameId { get; set; }

        [Display(Name = "操作时间")]
        [Required(ErrorMessage = "此项必填")]
        public DateTime ChangeDate { get; set; }

        [Display(Name = "数量")]
        [Range(0, 10000, ErrorMessage = "{0}必需大于{1}小于{2}")]
        [Remote(action: nameof(WereHouseController.ItemInventoryVerify), controller: "WereHouse", AdditionalFields = nameof(Count) + "," + nameof(ItemNameId) + "," + nameof(IsRuKu))] //验证 物品是否存在, 出库时库存是否充足
        public double? Count { get; set; }

        [Display(Name = "事件")]
        public IsRuKu IsRuKu { get; set; }

        [Display(Name = "物品")]
        [ForeignKey(nameof(ItemNameId))]
        public virtual TbWuPinInfo ItemNameNavigation { get; set; }
        [Display(Name = "操作人")]
        public string Recorder { get; set; }

        //public static string Reisruku(bool args)
        //{
        //    return args ? "入库" : "出库";
        //}
    }
}